package com.collect.zambia.zhiAdater.zhiAuditerPerfermance;

import android.view.View;
import android.widget.TextView;

import androidx.core.content.ContextCompat;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.collect.zambia.R;
import com.collect.zambia.zhiBean.zhiReceive.ZHIRAuditerWholeKfDayBonusDetailDayEntity;

public class ZHIAuditerPerfermanceDetail extends BaseQuickAdapter<ZHIRAuditerWholeKfDayBonusDetailDayEntity, BaseViewHolder> {

    public ZHIAuditerPerfermanceDetail() {
        super(R.layout.item_auditer_perfermance_detail, null);
    }

    @Override
    protected void convert(BaseViewHolder helper, ZHIRAuditerWholeKfDayBonusDetailDayEntity item) {
        helper.setText(R.id.textAuditerPerfermanceDetailName, item.getFullName());
        helper.setText(R.id.textAuditerPerfermanceDetailProduct, item.getProduct() + "");
        helper.setText(R.id.textAuditerPerfermanceDetailMobile, item.getMobileEnptry() + "");
        helper.setText(R.id.textAuditerPerfermanceDetailPassDateValue, item.getUpdateTime() + "");
        helper.setText(R.id.textAuditerPerfermanceDetailDisbursementDateValue, item.getLoanTime() + "");
        helper.setText(R.id.textAuditerPerfermanceDetailRepaymentDateValue, item.getRepayTime() + "");
        helper.setText(R.id.textAuditerPerfermanceDetailRealRepaymentDateValue, item.getRealRepayTime() + "");

        TextView textAuditerPerfermanceFlag = helper.getView(R.id.textAuditerPerfermanceFlag);
        TextView textAuditerPerfermanceDetailOverdueDays = helper.getView(R.id.textAuditerPerfermanceDetailOverdueDays);
        TextView textAuditerPerfermanceDetailOverdueDaysValue = helper.getView(R.id.textAuditerPerfermanceDetailOverdueDaysValue);
        if (item.isBonus()) {
            textAuditerPerfermanceFlag.setBackgroundColor(ContextCompat.getColor(mContext, R.color.green));
            textAuditerPerfermanceFlag.setText("+");
            textAuditerPerfermanceDetailOverdueDaysValue.setText("<=7");
            textAuditerPerfermanceDetailOverdueDaysValue.setVisibility(View.VISIBLE);
            textAuditerPerfermanceDetailOverdueDays.setVisibility(View.VISIBLE);

        } else if (item.isPenalty()) {
            textAuditerPerfermanceFlag.setBackgroundColor(ContextCompat.getColor(mContext, R.color.red));
            textAuditerPerfermanceFlag.setText("-");
            textAuditerPerfermanceDetailOverdueDaysValue.setText(">=8");
            textAuditerPerfermanceDetailOverdueDaysValue.setVisibility(View.VISIBLE);
            textAuditerPerfermanceDetailOverdueDays.setVisibility(View.VISIBLE);

        } else {
            textAuditerPerfermanceFlag.setBackgroundColor(ContextCompat.getColor(mContext, R.color.theme_yellow_6));
            textAuditerPerfermanceFlag.setText("x");
            textAuditerPerfermanceDetailOverdueDaysValue.setVisibility(View.GONE);
            textAuditerPerfermanceDetailOverdueDays.setVisibility(View.GONE);
        }
    }
}
